using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.Linq;

namespace Soussous.DAO.Connection
{
    abstract class AbstractConnection
    {
        public static int DEFAULT_PORT = 3306;

        private string server;
        private int port = 3306;
        private string database;
        private string user;
        private string password;

       

        public string Server
        {
            get { return server; }
            set { server = value; }
        }

        public int Port
        {
            get { return port; }
            set { port = value; }
        }

        public string Database
        {
            get { return database; }
            set { database = value; }
        }

        public string User
        {
            get { return user; }
            set { user = value; }
        }

        public string Password
        {
            get { return password; }
            set { password = value; }
        }

        public AbstractConnection(string server, int port, string database, string user, string password)
        {
            this.Server = server;
            this.Port = port;
            this.Database = database;
            this.User = user;
            this.Password = password;
        }

        public AbstractConnection(string server, string database, string user, string password)
        {
            this.Server = server;
            this.Database = database;
            this.User = user;
            this.Password = password;
        }

        public DataContext open()
        {
            return connectInternal();
        }
       

        protected abstract DataContext connectInternal();
    }
}
